﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using CoreEx.Common.Reflection;
using LinFu.IoC.Configuration;

namespace CoreEx.Wcf.Common.Implementation
{
    [Implements(typeof(ITypeDescriptor))]
    public class TypeDescriptior : ITypeDescriptor
    {
        private Type _targetType;


        public TypeDescriptior(Type targetType)
        {
            _targetType = targetType;
        }

        public virtual IEnumerable<MethodInfo> GetMethods()
        {
            return _targetType.GetMethods();
        }

        public virtual IEnumerable<Type> GetParameterTypes(MethodInfo methodInfo)
        {
            return methodInfo.GetParameters().Select(p => p.ParameterType);
        }

        public virtual Type GetReturnType(MethodInfo methodInfo)
        {
            return methodInfo.ReturnType;
        }
    }
}
